(define (member-of-set? x set)
  (cond ((null? set) #f)
        ((eq? x (car set)) set)
        (else (member-of-set? x (cdr set)))))

(define (adjion-set x set)
  (if (member-of-set? x set)
      set
      (cons x set)))

(define (intersection-set set1 set2)
  (cond ((or (null? set1) (null? set2)) '())
        ((member-of-set? (car set1) set2)
         (cons (car set1) 
               (intersection-set (cdr set1) set2)))
        (else (intersection-set (cdr set1) set2))))

(define (union-set set1 set2)
  (cond ((null? set1) set2)
        ((null? set2) set1)
        ((member-of-set? (car set1) set2)
         (union-set (cdr set1) set2))
        (else (cons (car set1)
                    (union-set (cdr set1) set2)))))


(member-of-set? 1 (list 1 2 3))
(member-of-set? 4 (list 1 2 3))
(adjion-set 4 (list 1 2 3))
(intersection-set (list 1 2 3) (list 2 3 4))
(union-set (list 1 2 3) (list 2 3 4))
















